package com.xgggh.redpack.ui.home.viewbinder;

import android.text.TextUtils;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;

import com.jakewharton.rxbinding3.view.RxView;
import com.xgggh.redpack.R;
import com.xgggh.redpack.base.viewbinder.BaseItemViewBinder;
import com.xgggh.redpack.base.viewbinder.BinderViewHolder;
import com.xgggh.redpack.databinding.ContentHomeItemBinding;
import com.xgggh.redpack.domain.redpack.Pack;
import com.xgggh.redpack.ui.profile.PersonalActivity;
import com.xgggh.redpack.ui.redpack.OpenRedPackActivity;

import io.reactivex.Observable;

//未定义类型-提醒升级或者联系开发者
public class HomeViewUndefinedBinder extends BaseItemViewBinder<Pack> {

    @Override
    protected void onBindViewHolder(@NonNull BinderViewHolder holder, @NonNull Pack item) {
        super.onBindViewHolder(holder,item);
        ContentHomeItemBinding binding= DataBindingUtil.getBinding(holder.itemView);
        binding.setItem(item);
       if (item.getProfile()!=null && !TextUtils.isEmpty(item.getProfile().getHeadFile())){
           binding.header.setImageURI(item.getProfile().getHeadFile());
       }

        RxView.clicks(binding.itemParent)
                .subscribe(o -> {
                    Toast.makeText(baseActivity, "未知类型红包，请升级app或联系客服人员", Toast.LENGTH_SHORT).show();
                });
    }

    @NonNull
    @Override
    public int getResId() {
        return R.layout.content_home_item;
    }
}
